package com.lwj.controller.Option;

import com.lwj.annotation.RequirePermission;
import com.lwj.entity.RestEntity;
import com.lwj.service.configuration.PermissionService;
import com.lwj.vo.configuration.DepartmentRoleMenuVo;
import com.lwj.vo.configuration.PermissionCheckVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags ="测试权限")
@RestController()
@RequestMapping("/api/optionOne")
public class OptionOneController {
    @Autowired
    private PermissionService permissionService;

    @ApiOperation(value = "根据角色查询菜单树")
    @GetMapping("/select")
    @RequirePermission("api.optionOne.select")
    public RestEntity select(@RequestParam("departmentId") String departmentId){
        permissionService.permissionCheck(departmentId);
        PermissionCheckVo permissionCheckVo = permissionService.checkForList(departmentId);
        return RestEntity.success(permissionCheckVo);
    }

    @ApiOperation(value = "根据角色查询菜单树")
    @GetMapping("/save")
    @RequirePermission("api.optionOne.save")
    public RestEntity  save(@RequestParam("departmentId") String departmentId){
        return RestEntity.success();
    }
}
